// 法人构成图表
var axisLabel = {
        lineStyle: {
            show: true,
            color: '#053A62'
        },
        textStyle: {
            fontSize: 18,
            color: '#357ACC'
        }
    };
 
    var axisLine = {
        lineStyle: {
            color: '#053A62',
            width: 0,
        }
    };
    var splitLine = {
        lineStyle: {
            color: '#053A62'
        }
    };
var chart1_1; //法人构成
var opt_11; //法人构成option
 
var creat_Opt1_1 = function(opt1_2data){
	opt1_1 = {
			title : {
		        text: "法人",
		        //subtext: "6091.2公顷",
		        textStyle:{
		        	color:"#00ffcc",
		        	fontWeight:"normal",
		        	fontSize:"40"
		        },
		        x: "center",
		        y : "center",
		    },
	    tooltip: {
		show: true,
        //trigger: 'item',
        //formatter: "{a} <br/>{b}: {c} ({d}%)"
    },
	//color:[ '#00ffff', '#038a80', '#00ff99'],
    color:[ '#00ffff', '#00ff99','#00b050'],
    legend: {//图例
        orient: 'vertical',
        x: 'left',
		y: 'center',
		itemWidth: 13,
        itemHeight: 13,
		itemGap: 18,//图例间距
		borderRadius:0,
        data:['基础库实名法人','人工实名法人','证书实名法人'],
		icon:'stack',//图例圆角，还是扇形
		textStyle: {
			//"color": [ '#00ffff', '#038a80', '#00ff99'],
			"color":[ '#00ffff', '#00ff99','#00b050'],
			fontSize:18,
        },
    },
    series: [
        {
            name:'法人',
            type:'pie',
            radius: ['60%', '70%'],
            avoidLabelOverlap: false,
            label: {
                normal: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    show: false,
                    textStyle: {
                        fontSize: '30',
                        fontWeight: 'normal'
                    }
                }
            },
            labelLine: {
                normal: {
                    show: false
                }
            },
            data:opt1_2data
        }
    ]
   };
}

// 自然人构成图表

var chart1_2; //自然人
var opt_12; //自然人构成option
 
var creat_Opt1_2 = function(opt1_1data){
	opt1_2 = {
			title : {
		        text: "自然人",
		        //subtext: "6091.2公顷",
		        textStyle:{
		        	color:"#00ffcc",
		        	fontWeight:"normal",
		        	fontSize:"40"
		        },
		        x: "center",
		        y : "center",
		    },
	    tooltip: {
		show: true,
        //trigger: 'item',
        //formatter: "{a} <br/>{b}: {c} ({d}%)"
    },
	color:[ '#00ffff', '#00ff99', '#00b050', '#5972bf', '#038a80'],
    legend: {//图例
        orient: 'vertical',
        x: 'left',
		y: 'center',
		itemWidth: 13,
        itemHeight: 13,
		itemGap: 18,//图例间距
        data:['公安实名用户','支付宝实名用户','银联实名用户','人工实名用户','未实名用户'],
		icon:'stack',//图例圆角，还是扇形
		textStyle: {
			"color": ['#038a80', '#00ff99', '#00b050', '#5972bf', '#ffff00'],
			fontSize:18,
        },
    },
    series: [
        {
            name:'自然人',
            type:'pie',
            radius: ['60%', '70%'],
            avoidLabelOverlap: false,
            label: {
                normal: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    show: false,
                    textStyle: {
                        fontSize: '30',
                        fontWeight: 'normal'
                    }
                }
            },
            labelLine: {
                normal: {
                    show: false
                }
            },
            data:opt1_1data
        }
    ]
   };
}



// 增长趋势

var chart1_3; //增长趋势
var opt_13; //增长趋势option
 
var creat_Opt1_3 = function (xdata,strval1,strval2){
  // var line3 = echarts.init(document.getElementById("line3"));
	opt1_3 = {
        color: ['#00b0f0', '#ff0066'],
   	 title: {
         text: '增长趋势',
 		textStyle:{
 		        	color:"#00aeef",
 		        	fontWeight:"normal",
 		        	fontSize:"40"
 		        },
 		        x: "20px",
 		        y:"-10px",
     },
        legend: {
            x: '76%',
            y: 50,
            itemWidth: 10,
            itemHeight: 10,
            data: [{
                name: "法人(户)",
                textStyle: {color: '#00b0f0'}
            }, {
                name: "自然人(百户)",
                textStyle: {color: '#ff0066'}
            }]
        },
        grid: {
            x: 20,
            y: 100,
            x2: 40,
            y2: 30,
            borderWidth: 1,
            borderColor: '#05345A',
            containLabel: true,
        },
        tooltip: {
            trigger: 'axis'
        },
        calculable: true,
        xAxis: [
            /*{
                type: 'category',
                axisTick: {length: 0},
                splitLine: splitLine,
                axisLine: axisLine,
                axisLabel :{  
                    interval:0,	//	X轴 连续显示 
                    textStyle:{
                        fontSize:18 // 让字体变大
                    } 
                },
                data: xdata
            }*/
        	 {
                 type : 'category',
                 boundaryGap : false,
                 data : xdata,
     			axisLine: {
                     show: true,
                     onZero: true,
                     lineStyle: {
                            color: '#00acec',
                      }
     	
     	         },
     	         axisLabel: { interval: 0, rotate: 45, margin: 2, textStyle: {fontSize: 13 } }
             }
        ],
        yAxis: [
            {
                type: 'value',
                boundaryGap: true,
                axisTick: {length: 0},
                splitLine: splitLine,
                axisLine: axisLine,
                axisLabel: axisLabel,
                splitArea: {
                    show: true,
                    onGap: true,
                    areaStyle: {
                        color: ['rgba(6,29,62,.3)',
                            'rgba(6,29,62,.3)']
                    }
                },

            }
        ],
        series: [
            {
                name: "法人(户)",
                type: 'line',
                smooth: true,
                symbolSize:0,
                data:strval1

            },
            {
                name: "自然人(百户)",
                type: 'line',
                smooth: true,
                symbolSize:0,
                data:strval2

            }
        ]
    };

    //line3.setOption(line3Option);
}
/*var creat_Opt1_3 = function(opdata1,opdata2,opdata3){
	opt1_3 = {
		
	 title: {
        text: '增长趋势',
		textStyle:{
		        	color:"#00aeef",
		        	fontWeight:"normal",
		        	fontSize:"40"
		        },
		        x: "20px",
		        y:"-10px",
    },
    tooltip : {
		show: true,
        trigger: 'axis',
        axisPointer: {
            type: 'line',
            label: {
                backgroundColor: '#00a5e4',
				color: '#036292',
            }
        }
    },
	
	color:[ '#00a6e7', '#00ffcc'],
    legend: {
        data:[
		   {
			   name:'法人(户)',
			   textStyle: {
			       color: '#00a6e7',
			       fontSize:18,
               },
			   icon:'rect',
		   },
		   {
			   name:'自然人(百户)',
			   textStyle: {
				    color:'#00ffcc',
				    fontSize:18,
                },
		       icon:'circle',
		   }
		
		],
		right: '40px',
		y: 'top',
		itemGap:40,
		
		
		//show:true,
       
    },
    toolbox: {
      //  feature: {
     //       saveAsImage: {}
    //    },
		show: false,
    },
    grid: {
		
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true,
    },
    grid: {
        x: 20,
        y: 100,
        x2: 40,
        y2: 30,
        borderWidth: 1,
        borderColor: '#05345A',
        containLabel: true,
    },
    calculable: true,
    xAxis : [
        {
            type : 'category',
            boundaryGap : false,
            data : opdata1,
			axisLine: {
                show: true,
                onZero: true,
                lineStyle: {
                       color: '#00acec',
                 }
	
	         },
	         axisLabel: { interval: 0, rotate: 45, margin: 2, textStyle: {fontSize: 13 } }
        }
    ],
    yAxis : [
        {
            type : 'value',
			axisLine: {
                show: true,
                onZero: true,
                lineStyle: {
                       color: '#00acec',
                           }
	
	                  },
		      splitLine: {
              show: true,
			  lineStyle: {
			        color: ['#05385f'],
			        width: 1,
			        type: 'solid',
			  }
              },
        }
    ],
	
			  
    series : [
        {
            name:'法人(户)',
            type:'line',
            stack: '总量',
            areaStyle: {normal: {}},
            data:opdata2
        },
      
        {
            name:'自然人(百户)',
            type:'line',
			smooth: true,
            stack: '总量',
            symbolSize:8,
			symbol: 'circle',
			
            label: {
                normal: {
                   // show: true,
                    position: 'top'
                }
            },
            //areaStyle: {normal: {}},
            data:opdata3
        }
    ]
}
}*/


///////////////////////-----------------------------------------

// 颁证单位
var chart3_1; //颁证单位
var opt_31; //颁证单位option
 

		
var labelTop = {
    normal : {
		color:'#00ffcc',
        label : {
            show : false,
            position : 'top',
            formatter : '{b}',
            textStyle: {
                baseline : 'bottom'
            }
        },
        labelLine : {
            show : false,
        }
    }
};

var labelFromatter = {
    normal : {
        label : {
			show: true,	
            formatter : function (params){
                return  params.value 
            },
		    position: 'center',
			fontStyle: 'normal',
            textStyle: {
                 fontSize:40,
				 fontFamily:'微软雅黑 Light',
            }
        }
    },
}



var labelBottom = {
    normal : {
        color: '#052548',
        label : {
            show : false,
            position : 'center'
        },
        labelLine : {
            show : false
        }
    },
    emphasis: {
        color: 'rgba(0,0,0,0)'
    }
};

var radius = [70, 80];


var creat_Opt3_1 = function(){
	opt3_1 = {
    tooltip: {
        trigger: 'item',
        formatter: "{b}: {c} ({d}%)"
    },
    legend: {
	   show: true,
       x : '50px;',
       y : '260px',
	   itemWidth:0,
	   itemGap: 173,
	   textStyle : {
            color : '#00ffcc',
            fontSize : 24,
            fontWeight : 'normal'
        },
      data:[
          '颁证单位','证照类型','法人证照','自然人证照'
       ]
    },
   
    toolbox: {
        show : false,
    },
    series : [
        {
            type : 'pie',
            center : ['10%', '40%'],
            radius : radius,
            x: '0%', // for funnel
            itemStyle :labelFromatter ,
            data : [
                {name:'其他', value:46, itemStyle : labelBottom},
                {name:'颁证单位', value:54,itemStyle : labelTop}
            ]
        },
        {
            type : 'pie',
            center : ['35%', '40%'],
            radius : radius,
            x:'20%', // for funnel
            itemStyle : labelFromatter,
            data : [
                {name:'其他', value:56, itemStyle : labelBottom},
                {name:'证照类型', value:44,itemStyle : labelTop}
            ]
        },
        {
            type : 'pie',
            center : ['60%', '40%'],
            radius : radius,
            x:'40%', // for funnel
            itemStyle : labelFromatter,
            data : [
                {name:'其他', value:65, itemStyle : labelBottom},
                {name:'法人证照', value:35,itemStyle : labelTop}
            ]
        },
        {
            type : 'pie',
            center : ['85%', '40%'],
            radius : radius,
            x:'60%', // for funnel
            itemStyle : labelFromatter,
            data : [
                {name:'其他', value:70, itemStyle : labelBottom},
                {name:'自然人证照', value:30,itemStyle : labelTop}
            ]
        }       
    ]
};
}
//-------------------------------------------------------

// 证照使用情况

var chart3_2; //证照使用情况
var opt_32; //证照使用情况option

var creat_Opt3_2= function(opt3data1,opt3data2){
	opt3_2 = {
		  color: ['#3398DB'],
    tooltip : {
        trigger: 'axis',
        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis : [
        {
            type : 'category',
            data : opt3data1,
            axisTick: {
                alignWithLabel: true
            },
            axisLabel :{  
                interval:0,	//	X轴 连续显示
                rotate:40,	//	X轴 斜着显示
                textStyle:{
                    fontSize:18 // 让字体变大
                } 
            },
			axisLine: {
                show: true,
                onZero: true,
                lineStyle: {
                       color: '#00acec',
                           }
	
	                  }
        }
    ],
    yAxis : [
        {
            type : 'value',
			axisLine: {
                show: true,
                onZero: true,
                lineStyle: {
                       color: '#00acec',
                           }	
	                  },
		      splitLine: {
              show: true,
			  lineStyle: {
			        color: ['#05385f'],
			        width: 1,
			        type: 'solid',
			  }
              },
        }
		
    ],
    series : [
        {
            name:'证照入库数量',
            type:'bar',
            barWidth: '60%',
			barWidth : 30,
            data:opt3data2
        }
    ]		
}
}
//目录提供情况构成表--------------------------------------------------------

var chart4_2; //证照使用情况
var opt_42; //证照使用情况option

var creat_Opt4_2= function(opt4ydata,opt4sdata1,opt4sdata2,opt4sdata3){
	opt4_2 = {	
	 color:['#23b294','#0190ca','#ffc000'],
     tooltip : {
		show: true,
        trigger: 'axis',
        axisPointer: {
            type: 'line',
            label: {
                backgroundColor: '#00a5e4',
				color: '#036292',
            }
        }
    },
    legend: {
        data: ['目录', '资源挂接','共享服务'],
		textStyle:{    //图例文字的样式
           color:['#156364','#036292','#836a1a'],
           fontSize:12,
		},
		itemWidth: 13,
        itemHeight: 13,
		itemGap: 18,//图例间距
		borderRadius:0,
		icon:'stack',//图例圆角，还是扇形    
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'value',
        boundaryGap: [0, 0.01],
		axisLine: {
                show: true,
                onZero: true,
                lineStyle: {
                       		color: '#00acec',
                           }	
	                  },
			     splitLine: {
                 show: true,
				 lineStyle: {
                 color: ['#05385f'],
				 }			
              }
    },
    yAxis: {
        type: 'category',
        data: opt4ydata,
		 axisLine: {
                show: true,
                onZero: true,
                lineStyle: {
                       color: '#00acec',
                           }	
	                  },
		         splitLine: {
                 show: false
              },
    },
    series: [
        {
            name: '目录',
            type: 'bar',
            data: opt4sdata1,
			itemStyle: {
                    emphasis: {
                       // barBorderRadius: 7
                    },
                    normal: {
                        //barBorderRadius: 7,
                        color: new echarts.graphic.LinearGradient(
                            0, 0, 1, 0,
                            [
                                {offset: 0, color: '#166c6a'},
                                {offset: 1, color: '#21ab8f'}
                            ]
                        )
                    }
                }		
		},
        {
            name: '资源挂接',
            type: 'bar',
            data: opt4sdata2,
			itemStyle: {
                    emphasis: {
                       // barBorderRadius: 7
                    },
                    normal: {
                        //barBorderRadius: 7,
                        color: new echarts.graphic.LinearGradient(
                            0, 0, 1, 0,
                            [
                                {offset: 0, color: '#036b9d'},
                                {offset: 1, color: '#00a9e7'}
                            ]
                        )
                    }
                }
        },
		 {
            name: '共享服务',
            type: 'bar',
            data: opt4sdata3,
			itemStyle: {
                    emphasis: {
                       // barBorderRadius: 7
                    },
                    normal: {
                        //barBorderRadius: 7,
                        color: new echarts.graphic.LinearGradient(
                            0, 0, 1, 0,
                            [
                                {offset: 0, color: '#927417'},
                                {offset: 1, color: '#f4b902'}
                            ]
                        )
                    }
                }
        }
    ] 
	} 
}

//中间地图 
function showMap(mapdata,max){
	var map = echarts.init(document.getElementById("mid_wh_map"));
	$.get('../../js/screen/hubei.json', function (geoJson) {
        echarts.registerMap('HB', geoJson);
        map.setOption(option = { 
            tooltip: {
                trigger: 'item',
                formatter: '{b}<br/>{c}'
            },            
            visualMap: {
                min: 0,
                max: max,
                realtime: false,
                calculable: true,
                x:10,
                y:'20%',
                textStyle:{
                    color:'#fff',
                    fontSize:18
                },
                inRange: {
                    color: ['#194360','#0ca3b1', '#00ffff']
                }
            }, 
            series: [
                {
                    center:[112.17185,31.731877],
                    zoom:1,
                    aspectScale:1, 
                    type: 'map',
                    mapType: 'HB', // 自定义扩展图表类型
                    zoom: 1.26, 
                    itemStyle:{
                        normal:{
                        	label:{
                        		show:true,
	                            textStyle: {
	                                color: '#fff',
	                                fontSize:22
	                            }
                        	}
                        }, 
                        emphasis: {// 也是选中样式
                            borderWidth:1,
                            borderColor:'transparent',
                            //areaColor: '#ff0066',
                            label: {
                                show: true,
                                textStyle: {
                                    color: '#fff',
                                    fontSize:18
                                }
                            }
                        }
                    },
                    data:mapdata
                }
            ]
        });

    	map.on('click', function (params) {
    	    // 控制台打印数据的名称
    		getcitydata(params.name);
    	});
    });    
}




